<template>
	<view>

		<!-- 车辆型号 -->

		<view class="title">
		<uni-list v-for="(value,key,index) in vehicle_select" :key="index">
			<uni-list-item :note="value.id" :show-arrow=false :title="value.car_type_name" @click="choose"/>
		</uni-list>
		</view>

	</view>
</template>

<script>
import uniList from '@/components/uni-list/uni-list.vue'
	import uniListItem from '@/components/uni-list-item/uni-list-item.vue'
	export default {
		components: {
			uniList,
			uniListItem
		},
	data() {
		return {
			//商品描述html
			carData: {
				detail: '',
				factory_name: '选择',
				brand_name: '选择',
				vehicle_name: '选择',
				year_name: '选择',
				factory_id: '',
				brand_id: '',
				vehicle_id: '',
				year_id: ''
			},
			factory_select:[{name:'奥迪',next:true,dataid:'1'},{name:'宝马',next:true,dataid:'2'},],
			brand_select:[],
			vehicle_select:[],
			year_select:[],
		};
	},
	onShow() {


	},
	onLoad(e) {
		console.debug(e);
		this.carData.brand_id = e.id;
		this.loadFactoryList();
	},
	methods: {
		loadFactoryList: function() {
			//var indexNav = this.$SysCache.get("app_car_factorylist");
			var indexNav =false;
			if(indexNav){
				this.vehicle_select = indexNav;
			}else{
				this.$Request.post(this.$api.car.queryCarlist+"?level=3&parent_id="+this.carData.brand_id).then(res => {

					if (res.code == 200) {
						/*
						{"car_type_name":"帝豪","path":"1","level":1,"spells_code":"D","parent_id":1,"id":36026}
						*/
						this.vehicle_select = res.data;
						//this.$SysCache.put("app_car_factorylist",res.data,86400);
					}
				})
			}
		},
		choose:function(e){

			console.log('picker发送选择改变，携带值为', e);
			uni.navigateTo({url:'./year?id='+e});
			//this.index = e.target.value
			//this.vehicle_select = data
		},
	}
};
</script>

<style lang="scss">
page {
	background-color: #f8f8f8;
}

.description {
	.title {
		width: 100%;
		height: 80upx;
		display: flex;
		justify-content: center;
		align-items: center;
		font-size: 26upx;
		color: #999;
	}
}

</style>
